﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BE.Web.Betfair.Interface.Entities;
using System.Collections.ObjectModel;
using System.Diagnostics.Contracts;

namespace BE.Web.Betfair.Interface.Requests
{
    /// <summary>
    /// Represents a REquest for getting bets on a given Market
    /// </summary>
    public sealed class BetsByMarketRequest : SessionBasedRequest<ReadOnlyCollection<Bet>>
    {
        /// <summary>
        /// The Market for which the bets should be resolved
        /// </summary>
        public BetMarket BetMarket { get; private set; }

        [ContractInvariantMethod]
        void ObjectInvariant()
        {
            Contract.Invariant(this.BetMarket != null);

        }


        /// <summary>
        /// The Market request.
        /// </summary>
        /// <param name="market"></param>
        /// <param name="session"></param>
        /// <param name="completedAction"></param>
        public BetsByMarketRequest(BetMarket market, Session session, Action<ReadOnlyCollection<Bet>> completedAction) :
            base(session, completedAction)
        {
            Contract.Requires<ArgumentNullException>(market != null);
            Contract.Requires<ArgumentNullException>(session != null);
            Contract.Ensures(this.BetMarket != null);
            this.BetMarket = market;
        }
    }
}
